<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='lb'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-form-item">
                <form name="totalForm" id="totalForm" action="${web_domain}/mall/orderaftersale/list" method="get">

                    <%--<div class="layui-inline">--%>
                    <%--<label class="layui-form-label">订单编号</label>--%>
                    <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="orderNo" placeholder="请输入订单名称" value="<c:if test='${params.orderNo !=null}'>${params.orderNo}</c:if>" autocomplete="off" class="layui-input">--%>
                    <%--</div>--%>
                    <%--</div>--%>

                    <div class="layui-inline">
                        <label class="layui-form-label"><fmt:message key='sssj'/></label>
                        <div class="layui-input-inline">
                            <select name="merchant.id" lay-verify="required" lay-search="">
                                <option value="0"><fmt:message key='zjxzhssxz'/></option>
                                <c:forEach items="${merchants}" var="merchant">
                                    <option value="${merchant.id}" <c:if test="${merchant.id eq params.merchant.id}">selected="selected" </c:if>>${merchant.shopName}</option>
                                </c:forEach>
                            </select>

                        </div>
                    </div>


                    <!-- 需要排序的字段 -->
                    <%--<input type="hidden" class="feijin-orderby" name="orderByCreateTime" id="orderByCreateTimeParams" value="${params.orderByCreateTime}"/>--%>
                    <%--<input type="hidden" class="feijin-orderby" name="orderByPrice" id="orderByPriceParams" value="${params.orderByPrice}"/>--%>
                    <!-- 需要排序的字段 -->

                    <input type="hidden" name="status" value="${params.status}"/>

                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/></button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <div class="layui-card">
        <div class="layui-field-box layui-form">

            <%--<a href="${web_domain}/mall/orderaftersale/exports?orderNo=${params.orderNo}" class="layui-btn layui-btn-sm" id="export"><i class="layui-icon">&#xe601;</i> 导出订单</a>--%>

            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li
                            <c:if test="${params.status eq 0}">class="layui-this"</c:if> >
                        <a href="${web_domain}/mall/orderaftersale/list"
                           <c:if test="${params.status eq 0}">style="color: rgb(0, 150, 136)"</c:if> ><fmt:message key='qb'/></a>
                    </li>
                    <li <c:if test="${params.status eq 1}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/orderaftersale/list?status=1" <c:if test="${params.status eq 1}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='sqz'/></a>
                    </li>
                    <li <c:if test="${params.status eq 2}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/orderaftersale/list?status=2" <c:if test="${params.status eq 2}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='tkcg'/></a>
                    </li>
                    <li <c:if test="${params.status eq 3}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/orderaftersale/list?status=3" <c:if test="${params.status eq 3}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='tksb'/></a>
                    </li>
                </ul>
            </div>


            <table class="layui-table" lay-size="sm">
                <thead>
                <th><fmt:message key='xh'/></th>
                <th><fmt:message key='ddbh'/></th>
                <th><fmt:message key='sqsj'/></th>
                <th><fmt:message key='mjxx'/></th>
                <th><fmt:message key='mjxx1'/></th>
                <th><fmt:message key='tkje'/></th>
                <th><fmt:message key='ddzt'/></th>
                <th><fmt:message key='tkyy'/></th>
                <th><fmt:message key='shzt'/></th>
                <th><fmt:message key='cz'/></th>
                </thead>
                <c:forEach items="${page.result}" var="item" varStatus="status">
                    <tr>
                        <td>${status.index + 1 }</td>
                        <td>${item.order.orderNo}</td>
                        <td><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                        <td>
                            <p><fmt:message key='zh'/>：${item.member.username }</p>
                            <p><fmt:message key='shr'/>：${item.order.deliveryName }</p>
                            <p><fmt:message key='sj'/>：${item.order.deliveryMobile }</p>
                        </td>
                        <td>
                            <p><fmt:message key='dp'/>：${item.merchant.shopName }</p>
                            <p><fmt:message key='lxr'/>：${item.merchant.realName }</p>
                            <p><fmt:message key='dh'/>：${item.merchant.mobile }</p>
                        </td>
                        <td>
                            <fmt:formatNumber value="${item.refundPrice}" type="CURRENCY"/></td>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${item.order.status eq 1}"><fmt:message key='dfk'/></c:when>
                                <c:when test="${item.order.status eq 2}"><fmt:message key='dfh'/></c:when>
                                <c:when test="${item.order.status eq 3}"><fmt:message key='dsh1'/></c:when>
                                <c:when test="${item.order.status eq 4}"><fmt:message key='dpj'/></c:when>
                                <c:when test="${item.order.status eq 5}"><b style="color:green;"><fmt:message key='jywc'/></b></c:when>
                                <c:when test="${item.order.status eq 6}"><fmt:message key='yqx'/></c:when>
                            </c:choose>
                        </td>
                        <td>
                                ${item.afterSaleReason}
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${item.status eq 1}"><fmt:message key='sqz'/></c:when>
                                <c:when test="${item.status eq 2}"><fmt:message key='tkcg'/></c:when>
                                <c:when test="${item.status eq 3}"><fmt:message key='tksb'/></c:when>
                            </c:choose>
                        </td>
                        <td>
                            <div class="layui-btn-container">
                                <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-xs feijin-detail"><fmt:message key='ck'/></a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <jsp:include page="/commons/page.jsp" flush="true"/>
        </div>
    </div>

</div>

<script>

    //查看详情
    $(".feijin-detail").click(function () {

        var id = $(this).attr("data-id");

        layer.open({
            type: 2
            , title: '<fmt:message key='thd'/>'
            , content: '${web_domain}/mall/orderaftersale/' + id + '/detail'
            , maxmin: true
            , area: ['97%', '97%']
            , btn: ['<fmt:message key='fh'/>']
        });
    });

</script>
</body>
</fmt:bundle>
</html>